from gaevents.models import Gaevent
from gaevents.models import Gaeventlocation
from django.contrib import admin
from gausers.models import Gauser


class GaeventlocationAdmin(admin.ModelAdmin):

  fieldsets = [
    ('Address',			{'fields': ['address_1', 'city', 'state', 'zip']}),
    ('Details',			{'fields': ['latitude', 'longitude']}),

  ]
  
class LocationInline(admin.StackedInline):
  model = Gaeventlocation
  fieldsets = [
    ('Address',                 {'fields': ['address_1', 'city', 'state', 'zip']}),
    ('Details',                 {'fields': ['latitude', 'longitude']}),

  ] 



class GaeventAdmin(admin.ModelAdmin):
  #fields = ['eventname', 'eventstartdate', 'eventstarttime']
  fieldsets = [
    (None,			{'fields': ['eventname']}),
    ('Date Information',        {'fields' : [('eventstartdate', 'eventstarttime'), ('eventenddate', 'eventendtime')] }),
    ('Basic Info',		{'fields': ['eventdescription', 'tickets', 'supportemail', 'supportphone'] }),
    #('Location',                 {'fields': ['gaeventlocation']})
  ]
  list_display = ('eventname', 'eventstartdate', 'eventstarttime', 'eventdescription')
  list_filter  = ('eventstartdate', 'eventname')
  search_fields = ['eventname']
  date_hierarchy = 'eventstartdate'
  inlines = [LocationInline]

admin.site.register(Gaeventlocation, GaeventlocationAdmin)
admin.site.register(Gaevent, GaeventAdmin)
